# https://leetcode-cn.com/problems/longest-increasing-subsequence/
# 300. 最长递增子序列

from typing import List


class Solution:
    def lengthOfLIS(self, nums: List[int]) -> int:
        if len(nums) == 1:
            return 1

        dp = len(nums) * [1]
        # dp[0] = 1
        result = 0
        # print(dp)
        for i in range(1, len(nums)):
            for j in range(i):
                if nums[i] > nums[j]:
                    dp[i] = max(dp[i], dp[j] + 1)

            result = max(dp[i], result)
        # print(dp)
        return result


if __name__ == '__main__':
    a = Solution()

    print(a.lengthOfLIS([10, 9, 2, 5, 3, 7, 101, 18]))
